{!{MANAGE_PATH}/templates/common/header!}
<style type="text/css">
    body {
        font-family: 'Roboto', sans-serif;
        font-size: 16px;
        font-weight: 300;
        color: #888;
        line-height: 30px;
        text-align: center;
    }

    strong { font-weight: 500; }

    a, a:hover, a:focus {
        color: #4aaf51;
        text-decoration: none;
        -o-transition: all .3s; -moz-transition: all .3s; -webkit-transition: all .3s; -ms-transition: all .3s; transition: all .3s;
    }

    ::-moz-selection { background: #4aaf51; color: #fff; text-shadow: none; }
    ::selection { background: #4aaf51; color: #fff; text-shadow: none; }

    .btn-link-1 i {
        padding-right: 5px;
        vertical-align: middle;
        font-size: 20px;
        line-height: 20px;
    }

    /***** Top content *****/

    .inner-bg {
        padding: 75px 0 170px 0;
    }

    .top-content .text {
        color: #fff;
    }

    .top-content .text h1 { color: #fff; }

    .top-content .description {
        margin: 20px 0 10px 0;
    }

    .top-content .description p { opacity: 0.8; }

    .top-content .description a {
        color: #fff;
    }
    .top-content .description a:hover,
    .top-content .description a:focus { border-bottom: 1px dotted #fff; }

    .form-box {
        margin-top: 35px;
    }

    .form-top {
        overflow: hidden;
        padding: 0 25px 15px 25px;
        background: #fff;
        -moz-border-radius: 4px 4px 0 0; -webkit-border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;
        text-align: left;
    }

    .form-top-left {
        float: left;
        width: 75%;
        padding-top: 25px;
    }

    .form-top-right {
        float: left;
        width: 25%;
        padding-top: 5px;
        font-size: 66px;
        color: #ddd;
        line-height: 100px;
        text-align: right;
    }

    .form-bottom {
        padding: 25px 25px 30px 25px;
        background: #eee;
        -moz-border-radius: 0 0 4px 4px; -webkit-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
        text-align: left;
    }

    .form-bottom form textarea {
        height: 100px;
    }

    .form-bottom form button.btn {
        width: 100%;
    }

    .form-bottom form .input-error {
        border-color: red;
    }


</style>

<div class="top-content">
    <div class="inner-bg">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-md-6">
                    <div class="form-top">
                        <div class="form-top-left">
                            <h3>操作员登陆</h3>
                            <p>请输入你的账号和密码开始登陆:</p>
                        </div>
                        <div class="form-top-right">
                            <i class="fa fa-key"></i>
                        </div>
                    </div>
                    <div class="form-bottom">
                        <form id="form1" role="form" class="login-form">
                            <div class="form-group">
                                <label class="sr-only" for="user">Username</label>
                                <input type="text" name="user" placeholder="登陆名/手机号/邮箱" class="form-username form-control" id="user">
                            </div>
                            <div class="form-group">
                                <label class="sr-only" for="pass">Password</label>
                                <input type="password" name="pass" placeholder="密码" class="form-password form-control" id="pass">
                            </div>
                            <div class="form-group">
                                <div class="col-sm-10">
                                    <label class="form-check-label">
                                        <input class="form-check-input" type="checkbox" id="save"> 保存登陆信息
                                    </label>
                                </div>
                            </div>
                            <button type="submit" class="btn btn-success" id="btn_submit">开始登陆</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="/static/jquery/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="/static/jquery/jquery.md5.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $.backstretch("/{MANAGE_PATH}/static/images/login_back.jpg");
        $('.login-form input[type="text"], .login-form input[type="password"], .login-form textarea').on('focus', function() {
            $(this).removeClass('input-error');
        });

        $("#form1").submit(function () {
            var user = $("#user").val();
            var pass = $("#pass").val();

            if(user.length < 2) {
                $("#user").addClass("input-error");
                return false;
            }
            if(pass.length < 4) {
                $("#pass").addClass("input-error");
                return false;
            }

            var save = $("#save").is(':checked') ? 1 : 0;

            $.ajax({
                url: "?m=login&a=submit",
                type: "POST",
                data: {user: user, pass: $.md5(pass), save: save},
                dataType: "json",
                error: function(xhr,textStatus){
                    alert(textStatus);
                },
                success: function (data,textStatus,jqXHR) {
                    if(data.status == "error") {
                        alert(data.msg);
                    } else {
                        window.location.replace(data.msg);
                    }
                }
            });

            return false;
        });
    });
</script>

{!{MANAGE_PATH}/templates/common/footer!}